package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Panel;
import java.awt.Canvas;

public class MainMenu extends JFrame {

	private static MainMenu instance;
	
	public static MainMenu getInstance()
	{
		 if(instance == null)
	        {
	            instance = new MainMenu();
	        }
	        return instance;
	}
	
	
	private JPanel contentPane;
	private Customers cus;
	private ProdSelecter prods;
	private Suppliers supps;
	private Order o;
	
	public MainMenu() {
		setTitle("Main Menu");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 400, 200);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblWelcomeToWestern = new JLabel("Welcome to Western Style Ltd.");
		lblWelcomeToWestern.setBounds(113, 11, 157, 14);
		contentPane.add(lblWelcomeToWestern);
		
		JLabel lblPressTheButtons = new JLabel("Press the buttons below for more options:");
		lblPressTheButtons.setBounds(86, 30, 211, 14);
		contentPane.add(lblPressTheButtons);
		
		JButton btnCustomers = new JButton("Customers");
		btnCustomers.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cus = new Customers();
				cus.setVisible(true);
				dispose();
			}
		});
		btnCustomers.setBounds(65, 55, 110, 23);
		contentPane.add(btnCustomers);
		
		JButton btnProducts = new JButton("Products");
		btnProducts.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				prods = new ProdSelecter();
				prods.setVisible(true);
				dispose();
			}
		});
		btnProducts.setBounds(65, 102, 110, 23);
		contentPane.add(btnProducts);
		
		JButton btnSuppliers = new JButton("Suppliers");
		btnSuppliers.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				supps = new Suppliers();
				supps.setVisible(true);
				dispose();
			}
		});
		btnSuppliers.setBounds(199, 55, 110, 23);
		contentPane.add(btnSuppliers);
		
		JButton btnMakeAnOrder = new JButton("Order");
		btnMakeAnOrder.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				o = new Order();
				o.setVisible(true);
				dispose();
			}
		});
		btnMakeAnOrder.setBounds(199, 102, 110, 23);
		contentPane.add(btnMakeAnOrder);
	}
}
